import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/widgets.dart';

import '../../global/state.dart';
import './bottom_navbar_component/state.dart';

class IndexPageState extends GlobalBaseState<IndexPageState> {
  int activeIndex;
  List<Widget> pages;

  IndexPageState({this.activeIndex, this.pages});

  @override
  IndexPageState clone() {
    return IndexPageState(
      activeIndex: activeIndex,
      pages: pages,
    )..themeColor = themeColor;
  }
}

IndexPageState initState(Map<String, dynamic> args) {
  return IndexPageState();
}

class BottomNavbarConnector extends ConnOp<IndexPageState, BottomNavbarState> {
  @override
  BottomNavbarState get(IndexPageState state) {
    return BottomNavbarState(
      activeIndex: state.activeIndex,
    );
  }

  @override
  void set(IndexPageState state, BottomNavbarState subState) {
    state.activeIndex = subState.activeIndex;
  }
}
